package com.koron.css2.systemManage.servlet;

import com.koron.css2.ApplicationConfig;
import com.koron.css2.ServerInterface;
import com.koron.css2.serviceManage.bean.RequestBean;
import com.koron.css2.serviceManage.bean.UserInfoBean;
import com.koron.util.Constant;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import org.koron.ebs.mybatis.SessionFactory;
import org.swan.bean.MessageBean;

import java.util.HashMap;
import java.util.Map;

/**
 * 权限平台页面链接地址
 * @author admin
 * @since 2021.09.03
 * @version 2.0
 *
 */
public class AuthorityViewUrl implements ServerInterface{
	
	private static Logger logger = LogManager.getLogger(AuthorityViewUrl.class);

	@Override
	public MessageBean<?> exec(SessionFactory factory, UserInfoBean userInfo, RequestBean req) {
		MessageBean<Map> msg = MessageBean.create(Constant.MESSAGE_INT_SUCCESS, "查询成功", Map.class);
		try {
			Map<String, String> urls = new HashMap<String, String>();
			urls.put("menuUrl", ApplicationConfig.getAuthorityMenuUrl() + req.getToken());
			urls.put("roleUrl", ApplicationConfig.getAuthorityRoleUrl() + req.getToken());
			msg.setData(urls);
		} catch (Exception e) {
			logger.error("获取权限平台页面链接地址出错：" + e);
			msg.setCode(Constant.MESSAGE_INT_FAIL);
			msg.setDescription("获取权限平台页面链接地址出错");
		}
		return msg;
	}

}
